package com.imay.live.model;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.imay.base.util.StringUtil;
import com.imay.live.adapter.TextMessageListAdapter;
import com.imay.live.cache.UserInfoCache;

import java.util.List;

/**
 * Created by  nick on 2017/5/6 0006.
 * 私信记录model
 */

public class TextMessageModel  {

    private String myHeadImg;
    private String yourHeadImg;
    private List<RecordModel> records;

    public String getMyHeadImg() {
        return myHeadImg;
    }

    public void setMyHeadImg(String myHeadImg) {
        this.myHeadImg = myHeadImg;
    }

    public String getYourHeadImg() {
        return yourHeadImg;
    }

    public void setYourHeadImg(String yourHeadImg) {
        this.yourHeadImg = yourHeadImg;
    }

    public List<RecordModel> getRecords() {
        return records;
    }

    public void setRecords(List<RecordModel> records) {
        this.records = records;
    }



    public static class RecordModel implements MultiItemEntity {
        private long chatRecordId;
        private long uid;
        private String content;
        private int createAt;
        private int firstChat;
        /**
         * 自己添加的属性
         */
        private String headImg;
        private String showTime;


        public String getShowTime() {
            return showTime;
        }

        public void setShowTime(String showTime) {
            this.showTime = showTime;
        }

        public String getHeadImg() {
            return headImg;
        }

        public void setHeadImg(String headImg) {
            this.headImg = headImg;
        }

        public long getChatRecordId() {
            return chatRecordId;
        }

        public void setChatRecordId(long chatRecordId) {
            this.chatRecordId = chatRecordId;
        }

        public long getUid() {
            return uid;
        }

        public void setUid(long uid) {
            this.uid = uid;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public int getCreateAt() {
            return createAt;
        }

        public void setCreateAt(int createAt) {
            this.createAt = createAt;
        }

        public int getFirstChat() {
            return firstChat;
        }

        public void setFirstChat(int firstChat) {
            this.firstChat = firstChat;
        }

        @Override
        public int getItemType() {
            if (uid==-1|| StringUtil.isEmpty(content)){
                return TextMessageListAdapter.ITEM_TYPE_HINT;
            }else{
                if (uid==UserInfoCache.getUserInfo().getUser().getUid()){
                    return TextMessageListAdapter.ITEM_TYPE_TEXT_RIGHT;
                }else{
                    return TextMessageListAdapter.ITEM_TYPE_TEXT_LEFT;

                }
            }
        }
    }

}
